#include"linklist.h"

int main(int argc, char const *argv[])
{
    linklist head = init_list();
    while(1){
        int n;
        scanf("%d", &n);
        if(n > 0){
            list_add_tail(head, new_node(n));
        }
        else if(n < 0){
            linklist p = del_node(head, -n);
            if(p == NULL){
                printf("未找到该对象！\n");
                continue;
            }
            free(p);
        }
        else
            break;
        list_for_each(head);
    }
    my_reverse_list(head);
    list_for_each(head);
    destory_list(head);
    return 0;
}